/*     */ package com.newcrm.webapi.sub;
/*     */ 
/*     */ import com.newcrm.bean.User;
/*     */ import com.newcrm.db.NoteManager;
/*     */ import com.newcrm.manager.CompanyStatusManager;
/*     */ import com.newcrm.util.Util;
/*     */ import com.newcrm.webapi.AbstractAction;
/*     */ import com.newcrm.webapi.AbstractHttpServlet;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintWriter;
/*     */ import java.util.Date;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import net.sf.json.JSONObject;
/*     */ 
/*     */ public class AddNote extends AbstractAction
/*     */ {
/*     */   public AddNote(AbstractHttpServlet servlet)
/*     */   {
/*  23 */     super(servlet);
/*     */   }
/*     */ 
/*     */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*     */     throws IOException
/*     */   {
/*  32 */     if (!CompanyStatusManager.getInstance().getAddNoteStatus()) {
/*  33 */       response.setContentType("text/html;charset=utf-8");
/*  34 */       PrintWriter out = response.getWriter();
/*  35 */       JSONObject jsonObject = new JSONObject();
/*  36 */       jsonObject.put("error", "1");
/*  37 */       jsonObject.put("msg", "数据一致性检测失败，请联系管理员检查");
/*  38 */       out.println(jsonObject);
/*  39 */       out.flush();
/*  40 */       out.close();
/*  41 */       return;
/*     */     }
/*     */ 
/*  44 */     int parentCustomerId = Util.getURLIntParameter(request
/*  45 */       .getParameter("ParentCustomerId"));
/*     */ 
/*  47 */     int subjectId = Util.getURLIntParameter(request
/*  48 */       .getParameter("SubjectId"));
/*  49 */     String subjectName = request.getParameter("SubjectName");
/*  50 */     int subjectType = Util.getURLIntParameter(request
/*  51 */       .getParameter("SubjectType"));
/*     */ 
/*  53 */     String attachFiles = request.getParameter("AttachFiles");
/*     */ 
/*  55 */     int dealId = Util.getURLIntParameter(request.getParameter("DealId"));
/*  56 */     String dealName = request.getParameter("DealName");
/*     */ 
/*  58 */     Date noteDate = Util.str2Date2(request.getParameter("NoteDate"));
/*  59 */     Date nextContactDate = Util.str2Date2(request
/*  60 */       .getParameter("NextContactDate"));
/*  61 */     if (noteDate == null) {
/*  62 */       noteDate = new Date();
/*     */     }
/*     */ 
/*  65 */     User loginUser = super.getLoginUser(request);
/*  66 */     String userId = loginUser.userId;
/*  67 */     String userName = loginUser.name;
/*  68 */     int companyId = loginUser.companyId;
/*     */ 
/*  70 */     String remark = request.getParameter("Remark");
/*     */ 
/*  86 */     int noteVisible = 1;
/*  87 */     String permissionsId = "";
/*     */ 
/*  89 */     NoteManager manager = new NoteManager();
/*  90 */     int noteId = 0;
/*     */ 
/*  92 */     noteId = manager
/*  93 */       .add(subjectId, subjectName, subjectType, attachFiles, 
/*  94 */       noteDate, nextContactDate, remark, noteVisible, 
/*  95 */       permissionsId, parentCustomerId, companyId, userId, 
/*  96 */       userName, dealId, dealName);
/*     */ 
/*  98 */     response.setContentType("text/html;charset=utf-8");
/*  99 */     PrintWriter out = response.getWriter();
/* 100 */     JSONObject jsonObject = new JSONObject();
/* 101 */     jsonObject.put("error", "0");
/* 102 */     jsonObject.put("noteId", Integer.valueOf(noteId));
/* 103 */     out.println(jsonObject);
/* 104 */     out.flush();
/* 105 */     out.close();
/*     */   }
/*     */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.AddNote
 * JD-Core Version:    0.6.1
 */